__author__ = 'st316'
'''
Implement strStr().

Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.
'''


class Solution:
    # @param haystack, a string
    # @param needle, a string
    # @return a string or None
    def strStr(self, haystack, needle):
        if not len(needle):
            return haystack
        i = 0
        l = len(needle)
        while i <= len(haystack) - l:
            if haystack[i:i + l] == needle:
                return haystack[i:]
            i += 1
        return None


if __name__ == '__main__':
    s = Solution()
    print s.strStr('a', '')